<%@ include file="/WEB-INF/jsp/include/head.jsp" %><%@ page language="java" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <%@ include file="/WEB-INF/jsp/include/title.jsp" %>
    <%@ include file="/WEB-INF/jsp/include/common_css.jsp" %>
    <link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/skin/${project.projectSkin}/default.css"/>"/>  
    <%@ include file="/WEB-INF/jsp/include/common_script.jsp" %>
    <script type="text/javascript" src="<c:url value="/js/editor/editor.js"/>"></script>
    <script type="text/javascript">
    //<![CDATA[
    <%@ include file="/js/bbs/bbs.js" %>

    function attach(obj, idx) {
        var val = obj.value;
        obj.style.display = 'none';

        addItem(++idx, val);
    }

    function addItem(idx, val) {
        var display_script = '<div id=\"pw_file_disply_items' + idx + '\">' + idx + '. ' + val + ' <font color=\"#000066\"><b onclick=\"removeItem(' + idx + ')\" style=\"cursor:pointer\">remove..<\/b><\/font><\/div>';
        var file_script = '<span id=\"pw_file_item' + idx + '\"><input id=\"file' + idx + '\" name=\"file[' + idx + ']\" type=\"file\" size=\"30\" onchange=\"attach(this, \'' + idx + '\')\" \/><\/span>';

        if(idx == 1)
            $("#pw_file_disply_items" + (idx - 1)).attr("innerHTML", "");
        
        $(display_script).insertAfter("#pw_file_disply_items" + (idx - 1));
        $(file_script).insertAfter("#pw_file_items");
    }

    function removeItem(id) {
        $("#pw_file_disply_items" + id).remove();
        $("#pw_file_item" + id).remove();

        if($(":file").length == 1) {
            $("#pw_file_disply_items0").attr("innerHTML", '<spring:message code="bbs.attachFileDesc"/>');
            $(":file").attr("value", "").show();
        }
    }

    $(window).load(function () {
        $("#sourceCode").editor({
            id : "sourceCode",
            isLoad : true,
            scriptUrl : "test.js",
            plugins : "empty",
            buttons : "bold,italic"
        });
    });
    //]]>
    </script>
</head>
<body>
<%@ include file="/WEB-INF/jsp/include/top.jsp" %>
    <form:form id="frmSpec" method="post" action="edit.do" enctype="multipart/form-data" modelAttribute="specCode" onsubmit="progress();">
    <form:hidden path="sid" id="sid" />
    <form:hidden path="specSid" id="specSid" />
    <form:hidden path="projectCode" id="projectCode" />
    <form:hidden path="delYn" id="delYn" />
    <input type="hidden" id="command" name="command" value="${param.command}" />
    <div id="pw_content">
    <c:choose>
    <c:when test="${bbsType.bbsType == 'A00101'}">
        <jsp:include page="./skin/${project.projectSkin}/code/edit.jsp" />
    </c:when>
    <c:otherwise>
        <jsp:include page="./skin/${project.projectSkin}/code/edit.jsp" />
    </c:otherwise>
    </c:choose>
    </div>
    </form:form>
<%@ include file="/WEB-INF/jsp/include/footer.jsp" %>    
</body>
</html>